<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        window.onload=function () {
            var jsonPerson={
                "name":"jack",
                "age":20
            }
            var strPerson = JSON.stringify(jsonPerson);
            console.log("jsonPerson=",jsonPerson)

            var strDog="{\"name\":\"小黑狗\",\"age\":2}"
            var jsonDog = JSON.parse(strDog);
            console.log("strDog=",strDog,"类型=",typeof strDog)

            var jsonPerson2={
                "name":"jakc",
                "age":20
            }
            console.log("jsonPerson2=",jsonPerson2)

            var strdog3="{\"name\":\"小黄狗~\",\"age\":4}"
            JSON.parse(strdog3);

            var strPerson2 = JSON.stringify(jsonPerson2);
            var parse = JSON.parse(strPerson2);
            console.log("parse=",parse)

        }
    </script>
</head>
<body>

</body>
</html>